date1 = extractBetween(date,1,4);
cd(output)
filename = sprintf('D_ts_estimation%d_%s.csv',x,date1{1});
D = csvread(filename);
filename = sprintf('param%s.mat',date{1});
param = load(filename);
alpha = param.param(x,2);
psi   = param.param(x,3);
gamma = param.param(x,4);
filename = sprintf('Sint%s.mat',date{1});
S = load(filename);
S = S.SS;
S = S(x,:);